package org.hfy;

import org.hfy.collections.helper.Symbol;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @Description:
 * @Author: Takagi
 * @date: 2023/4/26
 */
public class StringUtils {
    public static String extractNumbers(String str) {
        StringBuilder numbers = new StringBuilder();
        Pattern pattern = Pattern.compile("\\d+");
        Matcher matcher = pattern.matcher(str);

        while (matcher.find()) {
            String number = matcher.group();
            numbers.append(number);
        }

        return numbers.toString();
    }

    public static String extractNumbers(Symbol symbol) {
        String s = symbol.toString();
        return extractNumbers(s);
    }
}
